import request from '@/utils/request'
const baseUrl = '/cz-rentbox/api/v1/salePackingLists' //租箱服务-- 售箱提箱单
// import { getContainerNosByPackingId } from '@/api/boxDeal/tiXiangManage'

// :根据订单Id获取提箱单
export const getPackingList = (data: any) => {
  return request({
    url: baseUrl+'/'+data+'/packingLists',
    method: 'GET'
  })
}

// ## 下载提箱单设置提箱单状态为已下载
export const downloadStutas = (data: any) => { 
    return request({
      url: baseUrl+'/'+data+'/download',
      method: 'GET'
    })
}
/*
# 卖箱公司: 查询提箱单分页列表
# POST {{baseUrl}}/salePackingLists/saleBoxPage
# 过滤条件： 提箱单号:String packingNo   箱况:boxCondition   箱型:boxType
# 提箱单状态 5-已发放 10-已下载 15-提箱中 20-已完成  Integer status
# 买箱公司Id:buyBoxCompanyId  买箱公司名称:buyBoxCompanyName
*/
export const saleBoxPage = (data: any) => {
return request({
url: baseUrl+'/saleBoxPage',
method: 'post',
data: data
// data:{
//     "packingNo":"ZLOID2024062041957343",
//     "pageNum": 1,
//     "pageSize": 10
// }
})
}

/*
# 买箱公司: 查询提箱单分页列表
# POST {{baseUrl}}/salePackingLists/buyBoxPage
# 过滤条件： 提箱单号:String packingNo   箱况:boxCondition   箱型:boxType
# 提箱单状态 5-已发放 10-已下载 15-提箱中 20-已完成  Integer status
# 卖箱公司Id:companyId  卖箱公司名称:companyName 
*/
export const buyBoxPage = (data: any) => {
return request({
url: baseUrl+'/buyBoxPage',
method: 'post',
data: data
// data:{
//     "packingNo":"PLID2024062041957343",
//     "pageNum": 1,
//     "pageSize": 10
// }
})
}

/*
# 根据id查询提箱单详情
# GET {{baseUrl}}/salePackingLists/{id}
*/
export const getPackingInfo = (id: any) => {
return request({
url: baseUrl+'/'+ id,
method: 'GET'
})
}

/*
### 新增提箱单
## POST {{baseUrl}}/salePackingLists
*/
export const addPackingBoxSell = (data: any) => {
return request({
url: baseUrl,
method: 'POST',
data: data
// data:{
//       # boxType:箱型
//     # boxCondition:箱况
//     # orderList:订单List
//     # packingValidityPeriodStart:提箱单有效期开始时间
//     # packingValidityPeriodEnd:提箱单有效期结束时间
//     # 以上字段必填
//     # packingFileList:提箱单附件信息List
//     # remark:备注
})
}

/*
### 完成提箱单
## PUT  {{baseUrl}}/salePackingLists/batchFinish
# data:[1,2] 主键Id
*/
export const batchFinish = (data: any) => {
return request({
url: baseUrl+'/batchFinish',
method: 'PUT',
data: data
})
}

/*
# 根据提箱单id查询订单箱量
# GET {{baseUrl}}/salePackingLists/{id}/orderBoxQty
*/
export const orderBoxQty = (id: any) => {
return request({
url: baseUrl+'/'+id+'/orderBoxQty',
method: 'GET'
})
}

/*
### 卖箱提箱单:导出Excel文件
#POST  {{baseUrl}}/salePackingLists/exportSaleBoxPackingList
*/
export const exportSaleBoxPackingList = (data: any) => {
return request({
  responseType: 'blob',
  url: baseUrl+'/exportSaleBoxPackingList',
  method: 'POST',
  data: data
  // data:{
  //    "packingListIds": [
  //         1,2
  //     ]
  // }
  })
}

/*
### 买箱提箱单:导出Excel文件
#POST  {{baseUrl}}/salePackingLists/exportBuyBoxPackingList
*/
export const exportBuyBoxPackingList = (data: any) => {
return request({
  responseType: 'blob',
  url: baseUrl+'/exportBuyBoxPackingList',
  method: 'post',
  data: data
  // data:{
  //    "packingListIds": [
  //         1,2
  //     ]
  // }
  })
}

/*
### 根据提箱单Id:获取集装箱号的数组
## POST  {{baseUrl}}/salePackingLists/{id}/containerNos
*/
export const getContainerNosByPackingId = (id: any) => {
return request({
url: baseUrl+'/'+id+'/containerNos',
method: 'get'
})
}